package com.yx.yinshanjinniu.adapters;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.yx.yinshanjinniu.R;
import com.yx.yinshanjinniu.base.BaseRVAdapter;
import com.yx.yinshanjinniu.base.BaseRVHolder;
import com.yx.yinshanjinniu.bean.TransfeRecordBean;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

public class FundRecordAdapter extends BaseRVAdapter {
    private SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd HH:mm:ss", Locale.CHINA);

    public FundRecordAdapter(Context context, List list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return R.layout.item_fund_record;
    }

    @Override
    public void onBindView(BaseRVHolder holder, int position) {
        TextView tv_status = holder.getViewHolder().get(R.id.tv_status);
        TextView tv_time =  holder.getViewHolder().get(R.id.tv_time);
        TextView money_number =  holder.getViewHolder().get(R.id.money_number);
        TextView tv_content =  holder.getViewHolder().get(R.id.tv_content);

        TransfeRecordBean bean = (TransfeRecordBean)mList.get(position);
        tv_status.setText(bean.getStatus_str());
        tv_time.setText(dateFormat.format(new Date((long) (bean.getAdd_time() * 1000.0f))));
        money_number.setText("+ ¥"+bean.getAmount());


        if(bean.getStatus_str().contains("提现")){
            tv_content.setVisibility(View.VISIBLE);
            tv_content.setText(bean.getMsg());
        }else{
            tv_content.setVisibility(View.GONE);
            tv_content.setText("");
        }


    }

}
